<template>
  <el-container>
    <el-header>
      <div>
        <el-menu>
        <div class="line"></div>
        <el-menu
          :default-active="activeIndex2"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
         <el-submenu index="1">
            <template slot="title">保险分类</template>
            <el-input placeholder="输入关键字进行过滤"  v-model="filterText"></el-input>
            <el-tree  class="filter-tree" :data="data" :props="defaultProps"  default-expand-all  :filter-node-method="filterNode"  ref="tree"> </el-tree>      
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">我的工作台</template>
            <el-menu-item index="2-1">选项1</el-menu-item>
            <el-menu-item index="2-2">选项2</el-menu-item>
            <el-menu-item index="2-3">选项3</el-menu-item>
            <el-submenu index="2-4">
              <template slot="title">选项4</template>
              <el-menu-item index="2-4-1">选项1</el-menu-item>
              <el-menu-item index="2-4-2">选项2</el-menu-item>
              <el-menu-item index="2-4-3">选项3</el-menu-item>
            </el-submenu>
          </el-submenu>
          <el-menu-item index="3" >消息中心</el-menu-item>
          <el-menu-item index="4">
            <a href="#" target="_blank">订单管理</a>
          </el-menu-item>
        </el-menu>
      </div>
    </el-header>
    <el-main>
    <div class="dex">
        <el-carousel indicator-position="outside">
        <el-carousel-item v-for="item in img" :key="item">
        <img :src="item.image" alt="">
    </el-carousel-item>
     </el-carousel>
        </div>
    </el-main>
    <el-footer>Footer</el-footer>
  </el-container>
</template>

<script>
export default {
     data() {
      return {
          img:[
              {id:0,image:require('./img/1.png')},
              {id:1,image:require('./img/2.png')},
              {id:2,image:require('./img/3.jpg')},
              {id:3,image:require('./img/4.png')},
          ],
        activeIndex: '1',
        activeIndex2: '1',
         filterText: '',
        data: [{
          id: 1,
          label: '一级 1',
          children: [{
            id: 4,
            label: '二级 1-1',
            children: [{
              id: 9,
              label: '三级 1-1-1'
            }, {
              id: 10,
              label: '三级 1-1-2'
            }]
          }]
        }, {
          id: 2,
          label: '一级 2',
          children: [{
            id: 5,
            label: '二级 2-1'
          }, {
            id: 6,
            label: '二级 2-2'
          }]
        }, {
          id: 3,
          label: '一级 3',
          children: [{
            id: 7,
            label: '二级 3-1'
          }, {
            id: 8,
            label: '二级 3-2'
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        }
      };
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      },
      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      }
    },
       watch: {
      filterText(val) {
        this.$refs.tree.filter(val);
      }
    },
};
</script>

<style>
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
};
.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
};
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    margin: 0;
  }
  
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
  .dex{
      text-align: center;
      height: 400px;
  }
  img{
      width: 100%;
      height: 360px;
  }
</style>